package com.share.homestay.exception;

import com.share.homestay.consts.ResultCode;
import com.share.homestay.pojo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    // 根据实际自定义的异常统一处理
    @ExceptionHandler(value = BusinessException.class)
    public Result operationError(BusinessException e) {
        return Result.failure(ResultCode.FAIL, e.getMessage());
    }

}